|
|
|
|
|
|
|
intGetRow = 1
txtReturn = MSFlexGrid1.TextArray(intGetRow * MSFlexGrid1.Cols + intGetColumn) |
|
|
|
|
|
|
|
|
The final property is TextMatrix. This property requires two arguments: the index of the row and the index of the column to be retrieved. This property is probably the easiest of the three because it works the same as a standard array variable with two dimensions defined. The following code shows how TextMatrix would be used to retrieve the same value as the first example: |
|
|
|
|
|
|
|
|
intGetColumn = 1
intGetRow = 1
txtReturn = MSFlexGrid1.TextMatrix(intGetRow, intGetColumn) |
|
|
|
|
|
|
|
|
To see how this works, clear the form in your demo project and then add a FlexGrid control to the form. Set the Row property to 6 and the Column property to 4. Also, add a command button to the form and label it Add Data. Then in the command button's click event, add the following code: |
|
|
|
|
|
|
|
|
Dim intC as Integer
Dim intR as Integer
For intR = 1 to 5
For intC = 1 to 3
MSFlexGrid1.TextMatrix(intR, intC) = intR * intC
Next intC
Next intR |
|
|
|
|
|
|
|
|
When you execute this code in your application, it will actually show you the order in which the cells are accessed with the TextMatrix property. |
|
|
|
|
|
|
|
|
The Microsoft Hierarchical FlexGrid control is based largely on the standard MSFlexGrid control. However, the Hierarchical FlexGrid control can present grouped and related recordsets from a Data Environment Command hierarchy. The Hierarchical FlexGrid provides you with many display options that enable you to define a custom format that best suits your application's needs. |
|
|
|
|
|
|
|
|
A good example of using the Hierarchical FlexGrid is when you need to display a list of customers and all of the orders that they have in the database. The output would resemble the one shown in Figure 1.22. |
|
|
|
|
|
|
|
|
The biggest difference between the two FlexGrids is the requirement to use a Data Environment object (see Figure 1.23) to define the database access and the command structure for the query. You will learn more about the Data Environment Designer in Chapter 12, Enhancing Database Access, later in this book. |
|
|
|
|
|